package com.masterlu.module.trade.dal.mysql.order2;


import com.masterlu.framework.common.pojo.PageResult;
import com.masterlu.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.masterlu.framework.mybatis.core.mapper.BaseMapperX;
import com.masterlu.module.trade.controller.app.order2.vo.PackageOrderPageReqVO;
import com.masterlu.module.trade.dal.dataobject.order2.PackageOrderDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 套餐订单 Mapper
 *
 * @author 陆师傅源码
 */
@Mapper
public interface PackageOrderMapper extends BaseMapperX<PackageOrderDO> {

    default PageResult<PackageOrderDO> selectPage(PackageOrderPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<PackageOrderDO>()
                .eqIfPresent(PackageOrderDO::getNo, reqVO.getNo())
                .eqIfPresent(PackageOrderDO::getType, reqVO.getType())
                .eqIfPresent(PackageOrderDO::getTerminal, reqVO.getTerminal())
                .eqIfPresent(PackageOrderDO::getUserId, reqVO.getUserId())
                .eqIfPresent(PackageOrderDO::getUserIp, reqVO.getUserIp())
                .eqIfPresent(PackageOrderDO::getStatus, reqVO.getStatus())
                .eqIfPresent(PackageOrderDO::getCancelType, reqVO.getCancelType())
                .eqIfPresent(PackageOrderDO::getRemark, reqVO.getRemark())
                .eqIfPresent(PackageOrderDO::getCommentStatus, reqVO.getCommentStatus())
                .eqIfPresent(PackageOrderDO::getPackageId,reqVO.getPageSize())
                .eqIfPresent(PackageOrderDO::getPayPrice, reqVO.getPayPrice())
                .eqIfPresent(PackageOrderDO::getRefundStatus, reqVO.getRefundStatus())
                .eqIfPresent(PackageOrderDO::getRefundPrice, reqVO.getRefundPrice())
                .betweenIfPresent(PackageOrderDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PackageOrderDO::getId));
    }

}